//
//  NewsPushViewController.m
//  UI_A段项目_iDaily Watch
//
//  Created by 徐继垚 on 14-10-17.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "NewsPushViewController.h"
#import "NewsForthTableViewCell.h"
#import "NewsFifthTableViewCell.h"
#import "NewsModel.h"
#import "UIButton+WebCache.h"
@interface NewsPushViewController ()

@end

@implementation NewsPushViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        _getdata = [[NSMutableArray alloc]init];
        
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    _table3 = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320, 568 - 64) style:UITableViewStylePlain];
    _table3.delegate = self;
    _table3.dataSource = self;
    [self.view addSubview:_table3];
    self.tabBarController.tabBar.hidden = YES;
    
    
    
    
}
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden = YES;
}

-(NSInteger )tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
    
    
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (indexPath.row == 0 ) {
        NewsForthTableViewCell *cell = [[NewsForthTableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
        [cell.bbutton11 setBackgroundImageWithURL:[NSURL URLWithString:[_getdata[_index ]image2]] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"1.png"]];
        [cell.blable1 setText:[NSString stringWithFormat:@"%@",[_getdata[_index ]title]]] ;
        cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"6.jpeg"]];
        [cell.blable1 setFont:[UIFont systemFontOfSize:13]];
        [cell.blable2 setText:[NSString stringWithFormat:@"%@",[_getdata[_index ]pubdate1]]] ;
        
        [cell.blable2 setFont:[UIFont systemFontOfSize:12]];
        
        [cell.blable4 setText:[NSString stringWithFormat:@"%@",[_getdata[_index ]summary]]] ;
        [cell.blable4 setFont:[UIFont systemFontOfSize:12]];
        
        return cell;
    }
    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
    _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 265, 320, 1800)];
    
    _webView.scalesPageToFit = YES;
    _webView.scrollView.scrollEnabled = NO;
    
    [self.table3 addSubview:_webView];
    NSString *str1 = [_getdata[_index ]content];
    NSString *str2 = @"<font size=30>";
    NSString *str3 = @"<font/>";
    NSString  *str = [NSString stringWithFormat:@"%@%@%@",str2,str1,str3];
    //NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:str]];
    _webView.backgroundColor = [UIColor orangeColor];
    
    [_webView loadHTMLString:str baseURL:nil];
    
    return cell;
    
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        return 260;
    }
    return 1800;
    
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
 {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
